#ifndef GUI_MENU_MANAGER_H_H_H_
#define GUI_MENU_MANAGER_H_H_H_

#include<string>
#include <vector>
#include <QStringList>

class QAction;
class QMenu;

class MainWindow;
class MenuItem
{
public:

	MenuItem();
	MenuItem(MenuItem*);
	~MenuItem();

	void setCommand(const std::string&);
	std::string command()const;

	bool hasItems()const;
	MenuItem* findItem(const std::string&);
	MenuItem* copy()const;
	uint count()const;

	void appendItem(MenuItem*);	    
	bool insertItem(MenuItem*,MenuItem*);
	void removeItem(MenuItem*);
	void clear();

   MenuItem& operator << (MenuItem* item);
   MenuItem& operator <<(const std::string& command);
   QList<MenuItem*> getItems() const;


private:
	std::string _name;
	QList<MenuItem*> _items;


};

class MenuManager
{
public:
	void setup(MenuItem*)const;
	void setupContextMenu(MenuItem* itme,QMenu &menu)const;
	void retranslate()const;
	

	static MenuManager* getInstance();
	static void destruct();

protected:
	MenuManager(void);
	~MenuManager(void);

private:

	void setup(MenuItem*,QMenu*)const;
	void retranslate(QMenu*)const;
	QAction* findAction(const QList<QAction*>&,const QString&)const;
	QList<QAction*>findActions(const QList<QAction*>&,const QString&)const;

private:
	static MenuManager* _instance;

};
#endif